from cxk.封装 import SendMethod


class Event:

    def __init__(self):
        self.url = 'http://127.0.0.1:8000/'

    def add_event(self, pay_load):
        method = 'post'
        url = self.url + 'api/add_event/'
        return SendMethod.send_method(method=method, url=url, data=pay_load)

    def get_event(self, params):
        method = 'get'
        url = self.url + 'api/get_event_list/'
        return SendMethod.send_method(method=method, url=url, params=params)


class Guest:

    def __init__(self):
        self.url = 'http://127.0.0.1:8000/'

    def add_guest(self, payload):
        method = 'post'
        url = self.url + 'api/add_guest/'
        return SendMethod.send_method(method=method, url=url, data=payload)

    def get_guest(self, params):
        method = 'get'
        url = self.url + 'api/get_guest_list/'
        return SendMethod.send_method(method=method, url=url, params=params)

    def sign_guest(self, pay_load):
        method = 'post'
        url = self.url + 'api/user_sign/'
        return SendMethod.send_method(method=method, url=url, data=pay_load)


if __name__ == '__main__':
    cxk = Guest()
    payload = {
        "eid": 233333,
        "realname": "蔡徐坤",
        "phone": "12345678911",
        "email": "1@qq.com"
    }
    print(cxk.add_guest(payload))

    cxk = Event()
    data = {
        'eid': 122222,
        'name': 'requests发布会92',
        'limit': 3,
        'status': 1,
        'address': 'A4教室',
        'start_time': '2023-7-31 12:30:30'
    }
    print(cxk.add_event(data))
